from rest_framework import serializers

from apps.aiauth.models import Users, Userinfo
from apps.career.models import Careerplan
from apps.home.serializers import UsermedalSerializers, ProresultSerializers
from apps.setup.serializers import OrganizationsSerializer


class UserInfoSerializers(serializers.ModelSerializer):
    organization = OrganizationsSerializer()

    class Meta:
        model = Userinfo
        fields = ('organization',)


class CareerSerializer(serializers.ModelSerializer):
    # timeslot_id = TimesLotSerializer()

    class Meta:
        model = Careerplan
        fields = (
            'careerplan_id', 'title', 'timeslot_id',
            'is_studymaster', 'status'
        )


class UserCareerPlanSerializers(serializers.ModelSerializer):
    userinfo = UserInfoSerializers()
    user_careerplan = CareerSerializer(many=True)

    class Meta:
        model = Users
        fields = ('studentid', 'username', 'userinfo', 'user_careerplan')


class UserIceModelSerializers(serializers.ModelSerializer):
    userinfo = UserInfoSerializers()
    user_medal = UsermedalSerializers(many=True)
    user_proresult = ProresultSerializers(many=True)

    class Meta:
        model = Users
        fields = ('studentid', 'username', 'userinfo', 'user_medal', 'user_proresult')
